using NUnit.Framework;
using RMH.Entities;
using RMH.Web.Controllers;
using RMH.Web.Models.Binders;

namespace RMH.UnitTests.Web.Binders
{
    [TestFixture]
    public class DiagnosisBinder_when_binding_an_existing_Diagnosis : base_binding_test<DiagnosisController>
    {
        private Diagnosis diagnosis;
        private string newName = "Doooo";
        private int diagnosisId = 3;

        public override void establish_context()
        {
            form.Add("Id", diagnosisId.ToString());
            form.Add("Name", newName);
            context.HttpRequest.Setup(r => r.Form).Returns(form);
        }
        
        public override void because()
        {
            var binder = Create<DiagnosisBinder>();
            diagnosis = (Diagnosis)getBindingResult(binder);
        }

        [Test]
        public void diagnosis_is_returned()
        {
            diagnosis.Name.ShouldEqual(newName);
        }
        
//            private const string body = "Hello there.";
//            private CommentBinder binder;
//            private User user;
//            private BlogPost post;
//            public override void establish_context()
//            {
//                user = new User("ignu", "ignu.smith@gmail.com");
//                post = new BlogPost { PrettyUrl = "what-now" };
//                binder = Create<CommentBinder>();
//            }
//
//
//            public override void because()
//            {
//                form.Add("person.Address.Line1", body);
//                form.Add(CommentBinder.FormElements.PosterID.ToString(), user.ID.ToString());
//                form.Add(CommentBinder.FormElements.PostID.ToString(), post.PrettyUrl);
//            }
//
//            [Test]
//            public void a_proper_comment_object_is_returned()
//            {
//                context.HttpRequest.Expect(r => r.Form).Returns(form);
//                context.Expect(c => c.User.Identity.Name).Returns("Soundwave");
//                var result = binder.BindModel(new ControllerContext(context.Object, new RouteData(),
//                    new PostController()), new ModelBindingContext());
//                var comment = (Comment)result;
//                comment.Body.ShouldEqual(body);
//            }
        
    }
}

